/*
 * Copyright (c) 2009 Roman Savelyev
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef __IMPORTSWALKERTEST_H__
#define __IMPORTSWALKERTEST_H__

#include "TestSuite.h"

class CImportsWalkerTest : public CxxTest::TestSuite
    {
public:
    CImportsWalkerTest(const TDesC8& aSuitName);
    /**
     * Checks default field values after object created
     */
    void testInitiatlValues();
    /**
     * Checks import section with 0 blocks is allowed
     */
    void testEmptyImportSection();
    /**
     * Checks import section with 1 block is set correctly
     */
    void testOneBlockImportSection();
    /**
     * Checks import section with 2 blocks is set correctly
     */
    void testTwoBlocksImportSection();
    /**
     * Checks correct number of imports
     * (1 block with 5 imports)
     */
    void testCorrectNumberOfImportsA();
    /**
     * Checks correct number of imports
     * (2 blocks with 6 and 4 imports)
     */
    void testCorrectNumberOfImportsB();
    /**
     * Checks 0 imports in block invalidate section
     */
    void testZeroImportsNumberInBlock();
    /**
     * Checks negative number of imports in block invalidates section
     */
    void testNegativeImportsNumberInBlock();
    /**
     * Checks import block with name offset inside import block
     * is detected as corrupted
     */
    void testImportBlockNameOffsetInsideImportBlock();
    /**
     * Checks import block with name offset past section end
     * is detected as corrupted
     */
    void testImportBlockNameOffsetPastImportSection();
    /**
     * Checks import block with name offset inside section header
     * is detected as corrupted
     */
    void testImportBlockNameOffsetInsideSectionHeader();
    /**
     * Checks library name without 0-terminator invalidates section
     */
    void testImportBlockNameWithoutTerminator();
    /**
     * Checks call to Next() without Set() returns KErrNotReady
     */
    void testNextReturnsKErrNotReadyIfNoSet();
    /**
     * Checks call to Next() after failed Set() returns KErrNotReady
     */
    void testNextReturnsKErrNotReadyIfSetFailed();
    /**
     * Checks library name is correct after Next()
     */
    void testLibraryNameCorrect();
    /**
     * Checks SID is extracted properly
     */
    void testSIDCorrect();
    /**
     * Checks unmatched '{' invalidates section
     */
    void testUnMatchedOpeningCurly();
    /**
     * Checks unmatched '}' invalidates section
     */
    void testUnMatchedClosingCurly();
    /**
     * Checks incorrect SID length invalidates section
     */
    void testIncorrectSIDLength();
    /**
     * Checks incorrect SID format invalidates section
     */
    void testIncorrectSIDFormat();
    /**
     * Checks processing of section with 1 import
     */
    void testProcessingA();
    /**
     * Checks processing of section with 2 imports in 1 block
     */
    void testProcessingB();
    /**
     * Checks correct switch from one import block to another
     */
    void testSwitchNextBlock();
    /**
     * Checks repeated calls to Next() after walking finished
     * return KErrNotFound
     */
    void testRepeatedNextAfterFinished();
    /**
     * Checks walker can be reset after walking finished
     */
    void testReset();
    };

#endif /*__IMPORTSWALKERTEST_H__*/
